var http = {
    _timeout:3000,
    /**
     *
     * @param url
     * @type GET POST
     * @param jsonData 参数json 例如 {name:"zhangsan",passwd:"abcdef"}
     * @param sucessCallback 处理接口报文的函数或函数名 function类型或string类型 ajax回调会将受到的json.data响应作为参数传递给该回调函数 code=0000
     * @param failCallback 处理接口报文的函数或函数名 function类型或string类型 ajax回调会将受到的json响应作为参数传递给该回调函数 code!=0000
     */
    _ajax:function(url,type,jsonData,sucessCallback,failCallback){
        $.ajax({ url: url,type:type,data:jsonData,timeout:this.timeout}).done(function(data, textStatus){
            var json = data ;
            if(typeof data == "string")json = eval("("+data+")");
            if(json.code == "0000"){
                if(typeof sucessCallback == "function"){
                    sucessCallback(json.data);
                }else if(typeof sucessCallback == "string"){
                    eval(sucessCallback+"(json.data)");
                }else{
                    if(window.console)console.log("未指定或未知的sucessCallback");
                }
            }else{
                if(typeof failCallback == "function"){
                    failCallback(json);
                }else if(typeof failCallback == "string"){
                    eval(failCallback+"(json)");
                }else{
                    if(window.console)console.log("未指定或未知的failCallback");
                }
            }

        }).fail(function (XMLHttpRequest, textStatus, errorThrown) {
            if(window.console)console.log(textStatus);
            if(window.console)console.log(errorThrown);
        });
    },
    get:function(url,sucessCallback,failCallback){
        this._ajax(url,"GET",null,sucessCallback,failCallback);
    },
    post:function(url,jsonData,sucessCallback,failCallback){
        this._ajax(url,"POST",jsonData,sucessCallback,failCallback);
    }};